package com.effvi.common.consts.enumeration;

import java.util.HashMap;
import java.util.Map;

/**
 * 月份枚举
 * @author kelvin.zhang
 *
 */
public enum Month {
	/**
	 * 一月
	 */
	JANUARY,
	/**
	 * 二月
	 */
	FEBRUARY,
	/**
	 * 三月
	 */
	MARCH,
	/**
	 * 四月
	 */
	APRIL,
	/**
	 * 五月
	 */
	MAY,
	/**
	 * 六月
	 */
	JUNE,
	/**
	 * 七月
	 */
	JULY,
	/**
	 * 八月
	 */
	AGUEST,
	/**
	 * 九月
	 */
	SEPTEMBER,
	/**
	 * 十月
	 */
	OCTOBER,
	/**
	 * 十一月
	 */
	NOVEMBER,
	/**
	 * 十二月
	 */
	DECEMBER;
	private static Map<com.effvi.common.consts.enumeration.Month,String> monthDate;
	
	private static Map<com.effvi.common.consts.enumeration.Month,Integer> monthValue;
	
	/**
	 * 获取月份描述
	 * @param m
	 * @return
	 */
	public static String getMonthDescrption(Month m){
		if(monthDate == null){
			initMonthDate();
		}
		return monthDate.get(m);
	}
	
	/**
	 * 获取月份对应的值
	 * @param m
	 * @return
	 */
	public static Integer getMonthValue(Month m){
		if(monthValue == null){
			initMonthValue();
		}
		return monthValue.get(m);
	}
	
	/**
	 * 初始化月份描述
	 */
	private static synchronized void initMonthDate(){
		if(monthDate == null){
			monthDate = new HashMap<com.effvi.common.consts.enumeration.Month, String>();
			monthDate.put(JANUARY, "一月");
			monthDate.put(FEBRUARY, "二月");
			monthDate.put(MARCH, "三月");
			monthDate.put(APRIL, "四月");
			monthDate.put(MAY, "五月");
			monthDate.put(JUNE, "六月");
			monthDate.put(JULY, "七月");
			monthDate.put(AGUEST, "八月");
			monthDate.put(SEPTEMBER, "九月");
			monthDate.put(OCTOBER, "十月");
			monthDate.put(NOVEMBER, "十一月");
			monthDate.put(DECEMBER, "十二月");
		}
	}
	
	/**
	 * 初始化月份值
	 */	
	private static synchronized void initMonthValue(){
		if(monthValue == null){
			monthValue = new HashMap<com.effvi.common.consts.enumeration.Month, Integer>();
			monthValue.put(JANUARY, 1);
			monthValue.put(FEBRUARY, 2);
			monthValue.put(MARCH, 3);
			monthValue.put(APRIL, 4);
			monthValue.put(MAY, 5);
			monthValue.put(JUNE, 6);
			monthValue.put(JULY, 7);
			monthValue.put(AGUEST, 8);
			monthValue.put(SEPTEMBER, 9);
			monthValue.put(OCTOBER, 10);
			monthValue.put(NOVEMBER, 11);
			monthValue.put(DECEMBER, 12);
		}
	}
}
